﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using DOAN.DO;
using DOAN.BL;

namespace DOAN.Admin
{
    public partial class ChitietDethi : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["IDDT"] == null)
                    Response.Redirect("Xemdanhsachdethi.aspx");
                loadDT();

            }
        }

        public void loadDT()
        {
            int id = int.Parse(Request.QueryString["IDDT"].ToString());
            DethiDO obj = new DethiBL().Select(new DethiDO { Madethi = id });
            string strData = obj.Macauhoi;

            string[] separator = new string[] { "-" };
            string[] maCH = strData.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            foreach (string ma in maCH)
            {
                int ch = int.Parse(ma);
                rpt.DataSource = new CauhoiBL().Select(new CauhoiDO{ Macauhoi = ch});
                rpt.DataBind();
            } 
        }

        protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {   
        }

        public bool ktraA(string s)
        {
            s = s.ToUpper();
            if (s == "A")
                return true;
            else
                return false;
        }

        public bool ktraB(string s)
        {
            s = s.ToUpper();
            if (s == "B")
                return true;
            else
                return false;
        }

        public bool ktraC(string s)
        {
            s = s.ToUpper();
            if (s == "C")
                return true;
            else
                return false;
        }

        public bool ktraD(string s)
        {
            s = s.ToUpper();
            if (s == "D")
                return true;
            else
                return false;
        }
    }
}
